package com.wenan.ui.controls.charts
{
	import com.amcharts.axes.ValueAxis;
	import com.amcharts.chartClasses.ChartScrollbar;
	import com.wenan.ui.controls.charts.expand.AmChartSpecial;
	import com.wenan.ui.controls.charts.expand.AmGraphExpand;
	import com.wenan.ui.controls.charts.expand.AmLegendSpecial;
	import com.wenan.ui.controls.charts.expand.CategoryAxisExpand;
	import com.wenan.ui.controls.listBoxes.CheckListBoxItemEvent;
	import com.wenan.ui.controls.listBoxes.TitleCheckListBox;
	
	import flash.events.MouseEvent;
	
	import mx.collections.ArrayCollection;
	import mx.containers.Canvas;
	import mx.containers.HBox;
	import mx.containers.VBox;
	import mx.controls.Button;
	import mx.controls.Label;
	import mx.controls.Spacer;
	import mx.core.UIComponent;
	import mx.events.FlexEvent;
	import mx.rpc.events.ResultEvent;
	import mx.states.OverrideBase;
	
	/**
	 * 散点
	 * */
	public class Splashes extends SuperAmChartsModule
	{
		public var fileName:String;
		public var xField:String;
		public var title:String;
		public var yField:String;
		public var labelText:String;
		
		public var squareId:String;
		public function Splashes()
		{
			super();
		}
		
		public override function chartHandler(obj:Object=null):void
		{
			var v2:Canvas = new Canvas();
			v2.setStyle("horizontalAlign", "right");
			v2.percentHeight = 100;
			v2.percentWidth = 100;
			var type:Number = 5;
			acs = new AmChartSpecial(type, dataProvider);
			acs.addEventListener(FlexEvent.CREATION_COMPLETE, function (event:FlexEvent):void {
				initAxis();
			});
			var amGraph:AmGraphExpand = new AmGraphExpand();
			var amLegend:AmLegendSpecial = null;
			acs.id = "amChart";
			acs.percentWidth = 100;
			acs.percentHeight = 100;
			acs.startDuration(0.5);
			acs.amChart.setStyle("depth3D", depth3D);
			acs.amChart.setStyle("angle", angle);
			
			amGraph.balloonText = balloonText;
			amGraph.labelText = labelText;
			amGraph.setStyle("labelPosition", "inside");
			amGraph.xField = xField;
			amGraph.yField = yField;
			amGraph.lineAlpha = 0;
			amGraph.setStyle("bullet", "square");
			
			var leftValueAxis:ValueAxis = getValueAxisLeft();
			var bottomValueAxis:ValueAxis = getValueAxisBottom();
			
			acs.valueAxesSpecial([leftValueAxis, bottomValueAxis]);
			acs.balloon(getAmBalloon());
			acs.chartCursor(getChartCursor());
			
			acs.graphsList.push(amGraph);
			cs.graph = amGraph;
			acs.chartScrollbar(cs);
			v2.addElement(acs);
			v2.addElement(axisXImage);
			v2.addElement(axisYImage);
			
			var hbox:HBox = new HBox();
			var spa:Spacer = new Spacer();
			spa.width = 10;
			hbox.setStyle("bottom", 0);
			hbox.setStyle("right", 8);
			hbox.addChild(dateLabel);
			hbox.addChild(spa);
			v2.addElement(hbox);
			
			reportBox.addChild(v2);
		}
		
		
		public override function createReportPanel():UIComponent 
		{
			reportBox = new VBox();
			reportBox.setStyle("backgroundColor", "0xF1F8FE");
			reportBox.setStyle("borderColor", "0xBDCCDB");
			reportBox.setStyle("borderStyle", "solid");
			reportBox.setStyle("horizontalAlign", "center");
			reportBox.percentWidth = 100;
			reportBox.percentHeight = 100;
			var name:Label = new Label();
			name.text = titleName;
			name.setStyle("fontSize", titleSize);
			name.setStyle("color", titleColor);
			name.setStyle("fontWeight", "bold");
			name.setStyle("horizontalCenter", 0);
			var yHead:Label = new Label();
			yHead.text = yHeading.title;
			yHead.setStyle("color", yHeading.titleTextColor);
			yHead.setStyle("fontSize", yHeading.titleTextSize);
			yHead.setStyle("left", 20);
			yHead.setStyle("top", 20);
			
			var ex:Canvas = new Canvas();
			ex.percentWidth = 100;
			ex.addChild(name);
			ex.addChild(yHead);
			reportBox.addChild(ex);
			chartHandler();
			return reportBox;
		}
		
		protected function initAxis():void
		{
			axisXImage.x=acs.x+acs.width-50;
			axisXImage.y=acs.y+acs.height-acs.amChart.getStyle("marginBottom") -4;
			
			axisYImage.x=acs.amChart.getStyle("marginLeft") - 5;
			axisYImage.y=acs.y+30;
		}
		
	}
}